#include "mathhelper.h"
using namespace FsxWsUtils;

//
// Rad to deg
//
double MathHelper::radianToDegree(const double radian)
{
    double degree = 0;
    degree = radian * (180/M_PI);
    return degree;
}

//
// Deg to rad
//
double MathHelper::degreeToRadian(const double degree)
{
    double radian = 0;
    radian = degree * M_PI / 180;
    return radian;
}

//
// Inches Hg to millibar
//
double MathHelper::inchesHgToMillibars(const double inchesHg)
{
    return inchesHg * 33.8637526;
}

//
// Millibars to Inches Hg
//
double MathHelper::millibarsToInchesHg(const double millibars)
{
    return millibars * 0.0295301;
}

//
// Millibars to Inches Hg
//
double MathHelper::feetToMeters(const double feet)
{
    return feet * 0.3048;
}

//
// Pitch to KMl equivalent tilt
//
double MathHelper::pitchRadToKmlTiltDeg(const double pitchRad)
{
    double pitchDeg = MathHelper::radianToDegree(pitchRad);
    return -pitchDeg;
}

//
// Millibars to Inches Hg
//
double MathHelper::meterToFeet(const double meters)
{
    return meters / 0.3048;
}
